/* GUI CONVERTED from icptiq03.p (converter v1.76) Mon Apr  8 13:49:44 2002 */
/* icptiq03.p - UNALLOCATED INQUIRY                                           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.10 $                                                          */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 6.0     LAST MODIFIED: 04/16/90    BY: MLB *D021*                */
/* REVISION: 6.0     LAST MODIFIED: 10/03/91    BY: alb *D887*                */
/* REVISION: 7.0     LAST MODIFIED: 06/08/92    BY: PMA *F588*                */
/* REVISION: 7.0     LAST MODIFIED: 07/09/92    BY: PMA *F751*                */
/* Revision: 7.3     Last edit:     11/19/92    By: jcd *G339*                */
/* REVISION: 7.3     LAST MODIFIED: 11/23/92    BY: PMA *G344*                */
/* REVISION: 7.3     LAST MODIFIED: 12/23/93    BY: AIS *GI30*                */
/* REVISION: 8.5     LAST MODIFIED: 10/25/94    BY: TAF *J038*                */
/* REVISION: 8.5     LAST MODIFIED: 06/11/96    BY: *J0S5* Rob Wachowicz      */
/* REVISION: 8.6     LAST MODIFIED: 10/09/97    BY: GYK *K0PZ*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/13/00   BY: *N0KS* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.10 $    BY: Jean Miller          DATE: 04/06/02  ECO: *P056*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

define variable part like pt_part.
define variable site like ld_site.
define variable loc like ld_loc.
define variable stat like ld_status.
define variable lot   like ld_lot.

define variable qty_unall like ld_qty_all column-label "Qty Unallocated".


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   part
   site
   loc
   lot
   stat
with frame a no-underline width 80 THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   pt_desc1
   in_site
   in_qty_avail
   pt_um
   in_qty_all
with STREAM-IO /*GUI*/  frame b width 80
title color normal (getFrameTitle("SITE_SUMMARY",19)) no-underline.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

part = global_part.
site = global_site.

{wbrp01.i}
repeat:

   if c-application-mode <> 'web' then
      update part site loc lot stat  with frame a
   editing:

      if frame-field = "part" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i pt_mstr part pt_part part pt_part pt_part}
         if recno <> ? then do:
            part = pt_part.
            display part with frame a.
         end.
      end. /* IF FRAME-FIELD = "PART" */
      else if frame-field = "site" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i si_mstr site si_site site si_site si_site}
         if recno <> ? then do:
            display si_site @ site with frame a.
         end.
         recno = ?.
      end. /* ELSE IF FRAME-FIELD = "SITE" */
      else do:
         status input.
         readkey.
         apply lastkey.
      end.
   end. /* UPDATE PART SITE ... */

   {wbrp06.i &command = update &fields = "  part site loc lot stat" &frm = "a"}

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}

   hide frame b.
   hide frame c.

   for each ld_det no-lock where
             (ld_part = part or part = "")
         and (ld_site = site or site = "")
         and (ld_loc  = loc  or loc  = "")
         and (ld_stat = stat or stat = "")
         and (ld_lot  = lot  or lot  = "")
         and (ld_qty_oh - ld_qty_all > 0)
   with frame c width 80
   title color normal (getFrameTitle("LOCATION_DETAIL",23))
   break by ld_part by ld_site by ld_loc by ld_lot by ld_ref:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame c:handle).

      if first-of(ld_part) then
         find pt_mstr where pt_part = ld_part no-lock no-error.

      if first-of(ld_site) then do:

         clear frame c all.

         find in_mstr where in_part = ld_part and in_site = ld_site
         no-lock no-error.

         display
            pt_desc1
            in_site
            in_qty_avail
            pt_um
            in_qty_all
         with frame b STREAM-IO /*GUI*/ .

      end. /* IF FIRST-OF(LD_SITE) */

      /*       if first-of(ld_ref) then do:  */
      display
         ld_loc
         ld_lot column-label "Lot/Serial!Ref" WITH STREAM-IO /*GUI*/ .

      if ld_ref <> "" then do:
         down 1.
         display ld_ref @ ld_lot WITH STREAM-IO /*GUI*/ .
      end.

      display
         ld_status
         ld_date
         ld_expire
         (ld_qty_oh - ld_qty_all) @ qty_unall
         ld_grade WITH STREAM-IO /*GUI*/ .

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


   end. /* FOR EACH LD_DET ... */

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

end.

global_part = part.
global_site = site.

{wbrp04.i &frame-spec = a}
